package com.smforj.ssm.modules.lib.service.impl;

import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.smforj.ssm.frame.core.dao.BaseDao;
import com.smforj.ssm.frame.core.enums.Status;
import com.smforj.ssm.frame.core.service.impl.BaseServiceImpl;
import com.smforj.ssm.modules.lib.dao.EditingLogDao;
import com.smforj.ssm.modules.lib.domain.EditingLog;
import com.smforj.ssm.modules.lib.service.EditingLogService;
import com.smforj.ssm.util.DateConvert;
 

@Service("editingLogService")
public class EditingLogServiceImpl extends BaseServiceImpl<EditingLog> implements EditingLogService {

	@Autowired
	private EditingLogDao editingLogDao;
	
	@Override
	protected BaseDao<EditingLog> getBaseDao() {
		return editingLogDao;
	}

	@Override
	public long getEditingCount(String user) { 
		return editingLogDao.getEditingCount(user);
	}

	@Override
	public long getEditingDate(String user) {
		return editingLogDao.getEditingDate(user);
	}

	@Override
	public void insert(EditingLog entity) {
		Date date = new Date();
		entity.setCreate_date(date);
		entity.setUpdate_date(DateConvert.getTimestamp());
		entity.setStatus(Status.OFF);
		entity.setIsdeleted(false); 
		super.insert(entity);
	}  

}
